import main from '../../main';

/// 登录 得到token
export async function apiLogin(username: string, password: string) {
  let res = await main.api.post(
    '/auth/login',
    {
      username,
      password,
      clientId: main.clientId,
      grantType: 'password',
      tenantId: '574081',
      code: '',
      uuid: '',
    },
    {
      headers: {
        isToken: false,
        isEncrypt: true,
        repeatSubmit: false,
      },
    }
  );

  return res;
}

/// 获取用户信息
export async function apiGetUserInfo(token: string) {
  let res = await main.api.get('/system/user/getInfo');

  return res;
}

/// 退出登录
export async function apiLogout() {
  let res = await main.api.delete('/auth/logout');

  return res;
}

/// 获取路由表
export async function apiGetRouteDataList() {
  let res = await main.api.get('/system/menu/getRouters');

  return res;
}
